package com.aspose.cells;

import java.util.Iterator;

class zbrw {
   PivotTable a;
   PivotFieldCollection b;
   PivotFieldCollection c;
   PivotFieldCollection d;
   PivotFieldCollection e;
   PivotFieldCollection f;
   String g;
   String h;
   int i;
   short j;

   zbrw(PivotTable var1) {
      this.a = var1;
      this.h = "Data";
      this.i = 527;
      this.j = 1;
      this.b = new PivotFieldCollection(this.a, 0);
      this.e = new PivotFieldCollection(this.a, 2);
      this.d = new PivotFieldCollection(this.a, 1);
      this.c = new PivotFieldCollection(this.a, 8);
      this.f = new PivotFieldCollection(this.a, 4);
   }

   zbrw(PivotTable var1, String var2) {
      this.a = var1;
      this.g = var2;
      this.h = "Data";
      this.i = 527;
      this.j = 1;
      this.b = new PivotFieldCollection(this.a, this.a.d);
      this.e = new PivotFieldCollection(this.a, 2);
      this.d = new PivotFieldCollection(this.a, 1);
      this.c = new PivotFieldCollection(this.a, 8);
      this.f = new PivotFieldCollection(this.a, 4);
   }

   void a(int var1) {
      this.b = new PivotFieldCollection(this.a, this.a.d, var1);
   }

   void a(zbrw var1) {
      this.g = var1.g;
      this.h = var1.h;
      this.i = var1.i;
      this.j = var1.j;
      boolean var2 = false;
      int var3 = 0;

      Iterator var4;
      PivotField var5;
      for(var4 = var1.b.a.iterator(); var4.hasNext(); ++var3) {
         var5 = (PivotField)var4.next();
         this.a.getBaseFields().get(var3).a(var5);
      }

      var4 = var1.c.a.iterator();

      int var6;
      while(var4.hasNext()) {
         var5 = (PivotField)var4.next();
         var6 = this.a.addFieldToArea(8, var5.getBaseIndex());
         this.a.getDataFields().get(var6).a(var5);
      }

      var4 = var1.e.a.iterator();

      while(var4.hasNext()) {
         var5 = (PivotField)var4.next();
         if (var5.getBaseIndex() >= 0) {
            var6 = this.a.addFieldToArea(2, var5.getBaseIndex());
            if (var6 >= 0 && var6 < this.a.getColumnFields().getCount()) {
               this.a.getColumnFields().get(var6).a(var5);
            }
         } else if (this.a.getDataField().m == 1) {
            this.a.getRowFields().e(this.a.getDataField());
            this.a.getDataField().m = 2;
            com.aspose.cells.b.a.a.ze.a(this.a.getColumnFields().a, (Object)this.a.getDataField());
         }
      }

      var4 = var1.d.a.iterator();

      while(var4.hasNext()) {
         var5 = (PivotField)var4.next();
         if (var5.getBaseIndex() >= 0) {
            var6 = this.a.addFieldToArea(1, var5.getBaseIndex());
            if (var6 >= 0 && var6 < this.a.getRowFields().getCount()) {
               this.a.getRowFields().get(var6).a(var5);
            }
         } else if (this.a.getDataField().m == 2) {
            this.a.getColumnFields().e(this.a.getDataField());
            this.a.getDataField().m = 1;
            com.aspose.cells.b.a.a.ze.a(this.a.getRowFields().a, (Object)this.a.getDataField());
         }
      }

      var4 = var1.f.a.iterator();

      while(var4.hasNext()) {
         var5 = (PivotField)var4.next();
         var6 = this.a.addFieldToArea(4, var5.getBaseIndex());
         if (var6 >= 0 && var6 < this.a.getPageFields().getCount()) {
            this.a.getPageFields().get(var6).a(var5);
         }
      }

   }

   void a(boolean var1, int var2) {
      this.i &= ~var2;
      this.i |= var1 ? var2 : 0;
   }

   boolean b(int var1) {
      return (this.i & '\uffff' & var1) != 0;
   }
}
